// 在请求中的header中加上user_token_header, 作为令牌
$(document).ajaxSend(function (e, xhr, opt) {
    var user_token = localStorage.getItem("user_token");
    xhr.setRequestHeader("user_token_header", user_token);
});

function getUserInfo(userUrl){
    $.ajax({
        type:"get",
        url:userUrl,
        success:function(result){
            console.log(result);
            
            if (result.code == 1 && result.data != null && result.data.length != 0) {

                $(".left .card h3").text(result.data.userName);
                $(".left .card a").attr("href", result.data.githubUrl);
                $(".left .card #count #contentCount").text(result.data.contentCount);
                $(".left .card #count #contentCount").text(result.data.contentCount);
                if(result.data.headPortrait != null){
                $(".left .card img").attr("src", result.data.headPortrait);
                }
            }
        },
        error:function(err){
            console.log(err);
            
        }
    });
}

function logout(){
    localStorage.removeItem("user_token");
    location.href = "blog_login.html";
}